package com.smalls.newvideotwo.utils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolManager {
    public static ExecutorService dbOpretionPool;

    public static void init() {
        if (dbOpretionPool == null) {
            dbOpretionPool = Executors.newSingleThreadExecutor();
        }
    }

    public static void start(Thread t) {
        init();
        dbOpretionPool.execute(t);
    }

    public static void start(Runnable r) {
        init();
        dbOpretionPool.execute(r);
    }

    public static void shutdownSavePool() {
        dbOpretionPool.shutdownNow();
        dbOpretionPool = null;
    }
}
